﻿using Newtonsoft.Json;
using VideoTools.service;
using VideoTools.SubtitleEdit.Common;
using TaskStatus = VideoTools.vo.TaskStatus;

namespace VideoTools.Tasks
{
    public class OcrSupSubtitleTaskItem : NotifyPropertyBase
    {
        [JsonIgnore]
        public volatile bool ExitTask = false;

        private Paragraph _Paragraph;
        public Paragraph Paragraph
        {
            get => _Paragraph;
            set { SetProperty(ref _Paragraph, value); }
        }
        
        private bool _killed = false;
        [JsonIgnore]
        public bool Killed
        {
            get => _killed;
            set { SetProperty(ref _killed, value); }
        }
        private TaskStatus _status;

        [JsonIgnore]
        public TaskStatus Status
        {
            get => _status;
            set { SetProperty(ref _status, value); }
        }
        
        [JsonIgnore]
        public Action TaskAction { get; set; }

        public void Cancel()
        {
            Killed = true;
            Status = TaskStatus.Failed;
            ExitTask = true;
        }

        
    }
}
